#include "icyadds.h"

_fastcall IcyBuddy *getBuddyByAlias(const QString &sAlias, const IcyBuddies *buddies)
{
    qint32 iCount = buddies->count();
    for ( qint32 i = 0; i < iCount; i++ ){
        if ( buddies->at(i)->alias() == sAlias )
            return buddies->at(i);
    }
    return (IcyBuddy*) -1;
}

_fastcall IcyBuddy *getBuddyByScreenName(const QString &sSN, const IcyBuddies *buddies)
{
    qint32 iCount = buddies->count();
    for ( qint32 i = 0; i < iCount; i++ ){
        if ( buddies->at(i)->screenName() == sSN )
            return buddies->at(i);
    }
    return (IcyBuddy*) -1;
}

_fastcall IcyBuddy *getBuddyByIndex(const qint32 iIndex, const IcyBuddies *buddies)
{
    qint32 iCount = buddies->count();
    for ( qint32 i = 0; i < iCount; i++ ){
        if ( buddies->at(i)->index() == iIndex )
            return buddies->at(i);
    }
    return (IcyBuddy*) -1;
}
